package com.nba.dao.impl;

import java.util.List;

import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import com.nba.bean.Partition;
import com.nba.dao.PartitionDao;
import com.nba.util.DBUtil;

public class PartitionDaoImpl implements PartitionDao {
	
	JdbcTemplate jt = new JdbcTemplate(DBUtil.getDataSource());
	
	@Override
	public Partition selectPartitionId(String partitionName) {
		String sql  = "SELECT * FROM `partition` WHERE partition_name=?";
		List<Partition> list = jt.query(sql, new BeanPropertyRowMapper<Partition>(Partition.class),partitionName);
		if(list.size() == 0) {
			return null;
		}else {
			return list.get(0);
		}
	}

	

}
